package code.lewdy.lottery;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import code.lewdy.util.FormatUtil;
import code.lewdy.util.RandomUtil;

/**合买设置 发起合买
 * @author Administrator
 *
 */
@Entity
@Table
public class UnionBuySet {
	private Long id;
	private String orderId; //单号，与投注记录单号一致
	private int lotteryId;
	private String lotteryName;
	private Long betId; //投注记录id
	private Long initiatorId; //发起人id
	private String initiatorName; //发起人用户名
	private int partCount;  //划分份数
	private double partPrice; //每份单价,默认1元
	private double royaltiesRate; //提成比例 (8>=?>=0)
	private int viewId;  //公开程度 0-完全公开|1-截止后公开|2-仅跟单人可看
	private int initiatorBuyCount; //发起人购买份数
	private Date dealine; //截止日期
	private Date createDate;
	private double totalPaidAmount; //实付认购总金额
	private int isPay; //是否派奖 1-是|0-未
	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@Column(length=50)
	public String getOrderId() {
		return orderId;
	}
	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}
	public Long getBetId() {
		return betId;
	}
	public void setBetId(Long betId) {
		this.betId = betId;
	}
	public Long getInitiatorId() {
		return initiatorId;
	}
	public void setInitiatorId(Long initiatorId) {
		this.initiatorId = initiatorId;
	}
	@Column(length=30)
	public String getInitiatorName() {
		return initiatorName;
	}
	public void setInitiatorName(String initiatorName) {
		this.initiatorName = initiatorName;
	}
	public int getPartCount() {
		return partCount;
	}
	public void setPartCount(int partCount) {
		this.partCount = partCount;
	}
	public double getPartPrice() {
		partPrice = FormatUtil.formatDecimal(partPrice, 2);
		return partPrice;
	}
	public void setPartPrice(double partPrice) {
		this.partPrice = partPrice;
	}
	public double getRoyaltiesRate() {
		royaltiesRate = FormatUtil.formatDecimal(royaltiesRate, 4);
		return royaltiesRate;
	}
	public void setRoyaltiesRate(double royaltiesRate) {
		this.royaltiesRate = royaltiesRate;
	}
	public int getViewId() {
		return viewId;
	}
	public void setViewId(int viewId) {
		this.viewId = viewId;
	}
	public int getInitiatorBuyCount() {
		return initiatorBuyCount;
	}
	public void setInitiatorBuyCount(int initiatorBuyCount) {
		this.initiatorBuyCount = initiatorBuyCount;
	}
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return createDate;
	}
	@Transient
	public String getDate(){
		return FormatUtil.formatDate(createDate, "yyyy-MM-dd HH:mm:ss");
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public void setLotteryId(int lotteryId) {
		this.lotteryId = lotteryId;
	}
	public int getLotteryId() {
		return lotteryId;
	}
	public void setLotteryName(String lotteryName) {
		this.lotteryName = lotteryName;
	}
	@Column(length=30)
	public String getLotteryName() {
		return lotteryName;
	}
	public void setDealine(Date dealine) {
		this.dealine = dealine;
	}
	@Temporal(TemporalType.TIMESTAMP)
	public Date getDealine() {
		return dealine;
	}
	
	@Transient
	public String getDealineStr(){
		return FormatUtil.formatDate(dealine, "yyyy-MM-dd HH:mm:ss");
	}
	public void setTotalPaidAmount(double totalPaidAmount) {
		this.totalPaidAmount = totalPaidAmount;
	}
	public double getTotalPaidAmount() {
		return totalPaidAmount;
	}
	public void setIsPay(int isPay) {
		this.isPay = isPay;
	}
	public int getIsPay() {
		return isPay;
	}
	
}
